-
Notifications
You must be signed in to change notification settings - Fork 0
Always search games for new reviews #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always search games for new reviews #10
Conversation
The code was doing a `left join` (aka a `left outer join`) to `gameRatingsSandbox0_mv` unless `$browse` mode is enabled and you're using one of the specified sort orders, in which case it does a simple `join` (an `inner join`). I wrote this code in PR iftechfoundation#270, specifically in 3bd2c7a. But… why did I write that? Why didn't I just do an inner join in all cases? To be quite honest, I can't remember. I bet the issue was that `gameRatingsSandbox0_mv` didn't have exactly as many rows as the `games` table. (And I bet I was misusing `$browse` … it probably should have been `!$term`.) I believe that `gameRatingsSandbox0_mv` will always have a row for every game in the games table, now that we've merged iftechfoundation#1266, and so it should be safe to do an inner join in all cases.
…ames-for-new-reviews
|
I don't entirely understand this PR, but one thing I've noticed so far is that on the allnew page, there is supposed to be a "games were filtered on this page" announcement at the bottom of the page when the filter is applied. In this branch, that announcement does not display. It checks for the variable $game_filter_was_applied to decide whether to display the announcement. To reproduce, set up a filter, then on the home page, under new reviews, click "See the full list" to get to the allnew page. |
www/newitems.php
Outdated
| $sortby = "recently_reviewed"; | ||
| $games_limit_clause = "limit $reviews_limit"; | ||
| $browse = 0; | ||
| [$game_rows_after_filtering] = doSearch($db, $term, $searchType, $sortby, $games_limit_clause, $browse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where no filter is set, I don't understand why this search is being run. Is it accomplishing anything other than recording the gameid of every game in the database? Wait...there's a limit, so I guess it's recording the gameids of like the 8 most recently reviewed games...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I haven't tested this, but if there are no spare gameids--if we're just grabbing the exact number of games we need--then what happens if the last 8 games that got reviewed were reviewed by someone on my mute list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it is recording the gameids of the 8 most recently reviewed games, including whatever custom search filter you may or may not have applied, but not incorporating muting, so, if someone you've muted posts 8 reviews, the home page reviews section could turn up blank. I think that's fine, because it's probably never going to happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. When I test this, and mute two of the front page reviewers, I seem to still be getting the same number of reviews on the front page (6 reviews) as are on the live IFDB site, and I still seem to be getting 50 reviews when I go to the "see full list" page. I'm not sure why....
Do you mean the thing that checks for reviews from the past 365 days if there's a filter set? Or something else? We still end up sorting by last review regardless, right? |
Yes. |
| foreach ($game_rows_after_filtering as $game_row) { | ||
| $gameids_after_filtering[] = $game_row['id']; | ||
| } | ||
| $game_filter_was_applied = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing that taking this out is why the announcement on the allnew page does not appear.
$game_filter_was_applied (or the equivalent) is actually returned by doSearch anyway--we're just not tracking it. This change will bring back the "games have been filtered" announcement on the allnew page.
|
I tried to create a PR to your PR and that didn't work, so I added a commit that I think fixes the problem with the disappearing announcement. You can tell me what you think, I guess. I don't know if there's a way to get just the two things we need ($game_rows_after_filtering and $game_filter_was_applied) or if we have to get all of the values returned by doSearch. With my commit, it's getting them all. |
Add comment explaining "game_rows_after_filtering"
Fixes iftechfoundation#1275
I'm feeling kinda confused, and, before we merge this, you might want to double-check my work.
First off, I'm quite surprised to see that iftechfoundation#1275 is happening in the
mainbranch. I could've sworn I checked for this, but I can't see how this query could ever have possibly avoided a full scan. It's checking forreviewsrows that have a non-null written review, but there's no key for that.So I figured the best way to fix it would be to just have everybody use the new code that first searches for games with new reviews.
To actually make the reviews query benefit from this, I had to convert the
$games_after_filteringpost-query filtering code into SQL, adding agameid in (...).But then, I went in and explained the game-search query, just to be safe.
That seems like way more rows than needed, (we need no more than 8 games) so I poked around with the query some more. It turns out that we don't need the
lastreview:query filter at all!That query term was my idea in my long post about performance… and it looks like the reason it was needed was the
left jointogameRatingsSandbox0_mv. I merged iftechfoundation#1273 into this branch, and then, thelastreview:filter isn't needed.I dunno. It seems to do the right thing for logged out users, and it worked when I set
language:deas my custom search filter, even without a date limit.